
cc.Class({
    extends: cc.Component,

    properties: {
        exitPrefab:{
            default:null,
            type:cc.Prefab
        }
        
    },
   

    start(){
        this.initExitPre();
      
    },
        
    onClickstartGame:function () {
        cc.director.loadScene("start");
        this.node.destroy();
    },

    initExitPre(){
        if (this.exitPrefab === null) {
            return;
        }
        this.exitNode = cc.instantiate(this.exitPrefab);
        let pos = this.exitNode.position.x; 
        pos = -1100;
        this.exitNode.setPosition(pos);
        this.node.addChild(this.exitNode);
        //console.log(this.exitNode);
        this.exitNode.active = false;
        this.playAnim();
    },

    playAnim(){
        this.exitNode.active = true;
        this.scheduleOnce(()=>{
            this.exitAnim = this.exitNode.getComponent(cc.Animation);
            this.exitAnim.play('exit');
        },0.5)
    }

});
